home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Tools 2
/
Amiga Tools 2.iso
/
dfue
/
elcheapofax
/
all2fax.rexx
next >
Wrap
OS/2 REXX Batch file
|
1995-03-09
|
4KB
|
154 lines
/*
* All2fax.rexx
* $Id: all2fax.rexx,v 1.3 1993/07/01 00:44:20 Rhialto Exp $
*
* Copyright (C) 1993 by Olaf 'Rhialto' Seibert. All rights reserved.
*/
append = "" /* set for each non-first filepart */
invert = ""
raw = "-r" /* unset for last filepart */
verbose = ""
fontname = "courier.font"
fontsize = 30
outfile = "all.fax"
xoffset = 50
yoffset = 50 /* set to 0 for each non-first filepart */
infiles = 0
call doargs(arg(1))
do fi = 1 to infiles
ifp = ""
if open(ifp, infile.fi, "read") = 0 then do
say "Can't open input file" infile.fi
exit 20
end
call opentempfile
do forever
line = readln(ifp)
if eof(ifp) then leave
if left(line, 1) = "." then do
cmd = word(line, 1)
tail = delword(line, 1, 1)
select
when left(line, 2) = ".." then do
writeln(tfp, substr(line, 2)
dotfp = 1
end
when cmd = ".args" then do
call processtempfile
call doargs(tail)
end
when cmd = ".doit" then do
call doargs(tail)
call processtempfile
end
when cmd = ".iff" then do
call processtempfile
call doifffile(tail)
end
when cmd = ".raw" then do
call processtempfile
call dorawfile(tail)
end
when cmd = ".rexx" then do
say "REXX:" tail
interpret tail
end
when cmd = ".shell" then do
say "SHELL:" tail
address command tail
end
when cmd = "." then nop
otherwise do
say "Unknown directive:" line
end
end
end; else do
writeln(tfp, line)
say line
dotfp = 1
end
end
/* Last filepart */
if fi = infiles then raw = ""
call processtempfile
call closetempfile
call deletetempfile
end
doargs: /* (arguments) */
args = arg(1)
words = words(args)
do wi = 1 to words
w = word(args, wi)
select
when w = "-a" then append = w
when w = "--a" then append = ""
when w = "-i" then invert = w
when w = "--i" then invert = ""
when w = "-r" then raw = w
when w = "--r" then raw = ""
when w = "-v" then verbose = w
when w = "--v" then verbose = ""
when w = "-f" then do; wi=wi+1; fontname = word(args, wi); end
when w = "-s" then do; wi=wi+1; fontsize = word(args, wi); end
when w = "-o" then do; wi=wi+1; outfile = word(args, wi); end
when w = "-x" then do; wi=wi+1; xoffset = word(args, wi); end
when w = "-y" then do; wi=wi+1; yoffset = word(args, wi); end
otherwise do
infiles = infiles + 1
infile.infiles = w
end
end
end
return
opentempfile:
tfpname = "t:all2fax.tmp"
dotfp = 0
if open(tfp, tfpname, "write") = 0 then do
say "Can't open temporary file" tfpname
exit 20
end
return
closetempfile:
if close(tfp) = 0 then do
say "Can't close temporary file" tfpname
exit 20
end
return
deletetempfile:
address command "delete" tfpname
return
processtempfile:
if dotfp = 0 then return
call closetempfile
cmd = "asc2fax" append invert raw verbose,
"-f" fontname "-s" fontsize "-o" outfile "-x" xoffset "-y" yoffset,
tfpname
say cmd
address command cmd
call opentempfile
/* >= Second file part */
append = "-a"
yoffset = 0
return
doifffile: /* (arguments) */
cmd = "iff2fax" append invert raw verbose,
"-o" outfile "-x" xoffset "-y" yoffset,
arg(1)
say cmd
address command cmd
return
dorawfile: /* (arguments) */
cmd = "append" verbose "-o" outfile arg(1)
say cmd
address command cmd
return